from config import BASE_URL, NAME, PHONE, CARD
from page.page_login import LoginPage
from page.page_open import OpenPage
from page.page_register import RegisterPage
from tools import DriverTools


class TestLogin(object):

    def setup_method(self):
        # 打开浏览器

        driver = DriverTools.get_driver()
        # 输入网址
        # driver.get(BASE_URL + '/common/member/login')
        driver.get(BASE_URL + '/common/member/reg')
        # self.login_page = LoginPage(driver)
        self.reg_page = RegisterPage(driver)
        # 输入手机号 密码 验证码.....
        self.account_page = OpenPage(driver)

    def teardown_method(self):
        # 关闭浏览器
        DriverTools.quit_driver()

    def test01_open_success(self):
        # self.login_page.login('13845555578', 'w123456')
        self.reg_page.register(PHONE, 'w123456')
        self.account_page.open(NAME, CARD)
        result = self.account_page.get_Open_success()
        print(result)
        assert 'OK' in result
